package br.urca.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

@Embeddable
public class HabilitacaoPK implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@Column(name = "cdcur", columnDefinition = "CHAR(2)")
	private String codCurso;
	
	@Column(name = "cdhab", columnDefinition = "CHAR(2)")
	private String codHabilitacao;
	
	public HabilitacaoPK() { }

	public HabilitacaoPK(String codCurso, String codHabilitacao) {
		super();
		this.codCurso = codCurso;
		this.codHabilitacao = codHabilitacao;
	}

	public String getCodCurso() {
		return codCurso;
	}

	public void setCodCurso(String codCurso) {
		this.codCurso = codCurso;
	}

	public String getCodHabilitacao() {
		return codHabilitacao;
	}

	public void setCodHabilitacao(String codHabilitacao) {
		this.codHabilitacao = codHabilitacao;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((codCurso == null) ? 0 : codCurso.hashCode());
		result = prime * result
				+ ((codHabilitacao == null) ? 0 : codHabilitacao.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		HabilitacaoPK other = (HabilitacaoPK) obj;
		if (codCurso == null) {
			if (other.codCurso != null)
				return false;
		} else if (!codCurso.equals(other.codCurso))
			return false;
		if (codHabilitacao == null) {
			if (other.codHabilitacao != null)
				return false;
		} else if (!codHabilitacao.equals(other.codHabilitacao))
			return false;
		return true;
	}
	
}
